// 语法糖
// class Animal {
//   constructor(age) {
//     this.age = age;
//   }

//   eat() {
//     console.log('I eat');
//   }
// }
function Animal(age) {
  this.age = age;
}
Animal.prototype.eat = function () {
  console.log('i eat');
};
class Cat extends Animal {
  constructor(age, name) {
    super(age);
    this.name = name;
  }

  greet() {
    console.log('miao, I am', this.name);
  }
}

const wangcai = new Cat(3, 'wangcai');
wangcai.eat();
wangcai.greet();
